package com.qf.feign;

import com.qf.pojo.R;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class OrderFallbackFactory implements FallbackFactory<OrderFeignApi> {
    @Override
    public OrderFeignApi create(Throwable cause) {

        //对异常进行收集处理
        cause.printStackTrace();

        return new OrderFeignApi() {
            @Override
            public R findByUid(Integer id) {
                return R.error().putMsg("feign降级...");
            }
        };
    }
}
